package com.buddies.lottery.ui.lottery.bet.detail;

import com.buddies.lottery.base.BasePresenter;
import com.buddies.lottery.data.BaseObserver;
import com.buddies.lottery.data.DataManager;
import com.buddies.lottery.data.bean.LotteryBetRecord;
import com.buddies.lottery.data.resp.LotteryDetailResponse;

/**
 * Created by xuliang on 2018/2/28.
 */

public class LotteryBetDetailPresenter extends BasePresenter<LotteryBetDetailContract.View> implements LotteryBetDetailContract.Presenter {

    public LotteryBetDetailPresenter(LotteryBetDetailContract.View view) {
        super(view);
    }

    @Override
    public void loadLotteryBetDetail(int lotteryId) {
        addSubscription(DataManager.getInstance().getLotteryRepo().getLotteryBetDetail(lotteryId), new BaseObserver<LotteryBetRecord>() {
            @Override
            public void onNext(LotteryBetRecord betRecord) {
                mView.onLotteryBetDetailLoaded(betRecord);
            }

            @Override
            public void onError(Throwable e) {
               mView.onError(e);
            }
        });
    }

}
